/**
 * 
 */
package org.sensmon.core.datamodel;

import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;

import org.extdev.connection.ltr.LTR11LibConnection;
import org.extdev.libraries.ltr.LTR11APILibraryFacade;
import org.extdev.libraries.ltr.LTRData;
import org.extdev.libraries.ltr.LTRException;

/**
 * @author LAP
 *
 */
public class LTR11Connection extends LTR11LibConnection {

	private LTR11ObjectInputStram inputStream;
	
	public LTR11Connection(LTR11APILibraryFacade facade) throws LTRException, SecurityException, IOException {
		super(facade);
		inputStream = new LTR11ObjectInputStram();
	}

	@Override
	public InputStream getInputStream() throws Exception {
		return inputStream;
	}
	
	private class LTR11ObjectInputStram extends ObjectInputStream{
		public LTR11ObjectInputStram() throws SecurityException, IOException {
			super();
		}
		
		@Override
		protected Object readObjectOverride() throws IOException, ClassNotFoundException {
			LTRData data = null;
			try {
				data = facade.receive();
			} catch (Exception e) {
				// TODO: handle exception
			}
			return data;
		}
	}
}
